package in.muton.wicket.model;

import java.io.Serializable;
import java.util.List;

import org.apache.wicket.model.IModel;

public class ContainsHelper<T> implements Serializable  {
	private static final long serialVersionUID = -6464107754609754135L;
	private List<IModel<T>> originalList;
	
	public ContainsHelper(List<IModel<T>> originalList){
		this.originalList = originalList;
	}
	
	public boolean isPresent(T object){
		for(IModel<T> model:originalList){
			if(model.getObject() == object)
				return true;
		}
		return false;
	}
	
	public boolean isPresent(IModel<T> object){
		for(IModel<T> model:originalList){
			if(model.getObject() == object.getObject())
				return true;
		}
		return false;
	}
}
